package com.brush.system.domain.resp.sysdept;

import com.brush.common.core.domain.entity.SysDept;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;

import java.util.Date;
import java.util.List;

@Getter
@Setter
@ApiModel(value = "SysDeptResp", description = "部门响应对象")
public class SysDeptResp {

    @ApiModelProperty(value = "部门主键")
    private Long deptId;

    /**
     * 父部门ID
     */
    @ApiModelProperty(value = "父部门ID")
    private Long parentId;

    /**
     * 部门名称
     */
    @ApiModelProperty(value = "部门名称")
    private String deptName;

    /**
     * 显示顺序
     */
    @ApiModelProperty(value = "显示顺序")
    private Integer orderNum;

    /**
     * 部门状态:0正常,1停用
     */
    @ApiModelProperty(value = "部门状态:0正常,1停用")
    private String status;

    /**
     * 创建时间
     */
    @ApiModelProperty(value = "创建时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date createTime;

    @ApiModelProperty(value = "子部门")
    private List<SysDeptResp> children;

    /**
     * 默认构造函数(json序列化和反序列化正常)
     */
    public SysDeptResp() {

    }

    /**
     * 相当于转换对象
     *
     * @param dept
     */
    public SysDeptResp(SysDept dept) {
        this.deptId = dept.getDeptId();
        this.parentId = dept.getParentId();
        this.deptName = dept.getDeptName();
        this.orderNum = dept.getOrderNum();
        this.status = dept.getStatus();
        this.createTime = dept.getCreateTime();
    }

}
